#ifndef __FEM__ELEMENT__
#define __FEM__ELEMENT__

#include <vector>
#include "Point.hpp"
#include "Region.hpp"
#include <initializer_list>
#include <iostream>
#include <functional>
#include <array>

class Element
{
public:
    Element(unsigned long, std::initializer_list<Point>, bool);
    Point operator[](unsigned int);
    double integral(std::function<double(double, double)>, Region&);
    std::array<double, 2> l2g(double, double);
    std::array<double, 2> g2l(double, double);
    void add_point(Point&);
    friend class Grid;
    friend std::ostream& operator<<(std::ostream&, Element);
    friend unsigned long id(const Element&);
    friend bool is_boundary(const Element&);
    friend double Jacobi(const Element&);
protected:
    std::vector<Point> vertex;
    unsigned long index;
    bool marker;
};

#endif
